package com.cyjt.operation.bean;

import java.io.Serializable;
import java.util.Date;

import com.cyjt.operation.base.Tools;

/**
 * 动态节点数据查询
 * 
 * @author wsw
 * 
 */
public class NewDynamicNodeHeartBeat implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String nodeId;// 节点编码
	private int carCount;// 车辆数量
	private int occupy_time;// 占用时长
	private int sampling_time;// 采样时长
	private int voltage;// 电压值
	private int signal;// 信号量
	private int seq;// 序号
	private Date submitAt;// 上报时间

	public NewDynamicNodeHeartBeat(String nodeId, int carCount,
			int occupy_time, int sampling_time, int voltage, int signal,
			int seq, Date submitAt) {
		super();
		this.nodeId = nodeId;
		this.carCount = carCount;
		this.occupy_time = occupy_time;
		this.sampling_time = sampling_time;
		this.voltage = voltage;
		this.signal = signal;
		this.seq = seq;
		this.submitAt = submitAt;
	}

	public String getNodeId() {
		return nodeId;
	}

	public void setNodeId(String nodeId) {
		this.nodeId = nodeId;
	}

	public int getCarCount() {
		return carCount;
	}

	public void setCarCount(int carCount) {
		this.carCount = carCount;
	}

	public int getOccupy_time() {
		return occupy_time;
	}

	public void setOccupy_time(int occupy_time) {
		this.occupy_time = occupy_time;
	}

	public int getSampling_time() {
		return sampling_time;
	}

	public void setSampling_time(int sampling_time) {
		this.sampling_time = sampling_time;
	}

	public int getVoltage() {
		return voltage;
	}

	public void setVoltage(int voltage) {
		this.voltage = voltage;
	}

	public int getSignal() {
		return signal;
	}

	public void setSignal(int signal) {
		this.signal = signal;
	}

	public int getSeq() {
		return seq;
	}

	public void setSeq(int seq) {
		this.seq = seq;
	}

	public Date getSubmitAt() {
		return submitAt;
	}

	public void setSubmitAt(Date submitAt) {
		this.submitAt = submitAt;
	}

	public String getSubmitAtStringFromNow() {
		if (getSubmitAt() != null) {
			String s = Tools.diffTime(getSubmitAt(), new Date());
			if (s.equals("")) {
				return "刚刚";
			}
			return Tools.diffTime(getSubmitAt(), new Date()) + "前";
		}
		return "无提交时间";
	}

	public String getSubmitAtString() {
		if (getSubmitAt() == null) {
			return Tools.getDF(new Date()).toString();
		}
		return Tools.getDF(getSubmitAt()).toString();
	}

}
